package idpa.paul.hangman.view;

import java.util.Random;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class StartActivity extends Activity {

	TextView title;
	Button start;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_start);
		
		title = (TextView) findViewById(R.id.title_textView);
		start = (Button) findViewById(R.id.start_button);
		
		start.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(StartActivity.this, MainActivity.class);
				
				
				Random genWord = new Random();
				String[] wordList = getResources().getStringArray(R.array.dictionary);
				int numWord = genWord.nextInt(wordList.length);
		        i.putExtra("Word", wordList[numWord]);

		        startActivity(i);
				StartActivity.this.finish();
				
			}
		});
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.start, menu);
		return true;
	}

}
